package com.group.configurations;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000116696194";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCCMq+AEmRK7yGy66Uv5Iyz0ESIKhUzq7QG5SSO7Nb4JOPt0kU8xfE+kPNE4sca2Q0QCi3+wA8eEazFgChzJWkLh1lnE1gvYvQ+sjGIPRFKJpVjwl4RMtRhsv5qxb0N+ReZCIRmteEgFEegmzzvmkePbd1ew7s3w32zNhVA6e8vNGpehB5xslCsj9sc2eM4VODHkLwAs4AC+Sld9SC2fsRGGg7Aw7pOhKzvwt8wrTZSGigqjsgWRs4ofce+zvXZEIJWjfZ6TUOraFSI5XJbLMMREvOUzba4WfRN+qtgZ23gyvbyj+FK324wlteZl6pr1Ta0zynSrdIvMW1idfDJj7zvAgMBAAECggEAaghXT2krDq/TdQBeRjPOtv5NYctL+wnCEr9414FgzTRWAC/3vTfDcd3gkOBToLTV45M2xDqr1SQ13Z6y0pvMAdyX3c8uSWFAYvMCTd7V/tqPXXBE5aLMvkhk1JX3krKjGjmKgo9rKZH6h30F0miGEPQ7jdq/1Pk7nMDV7EjYR0swCxz9kMthJL3sO8zO6IQJZRPbcGXAf0Dzh+BgLsSmvoi3UIAad1iadCBS+vIPy5hBj+/lgA50f6sonnWMuW4wychGk5xKhQK+yNXgvp4Jo9dD+SJQH3UDSslZAFZi74Wm4gzty3dNEpHGxHIdqSOnb4+rgRBEWIL5XOgxsp9ZKQKBgQDOzkOrBqb6+7dTK4x6Zwmd3j/Sy8Ldbi20Gn9Kqd631mliFrjUKERgy7CL6nQHdlplNiydOdUrzjoohSCSK90tn/94BhbRWrjTr+isT/tsm/qAzJsTN8GcY9/IxAW+BYZz9tvIMyv1nnwchdmce619x/fo5dpR+fY8XS7aYqNggwKBgQChK0gqQR+sAb83L7ae3y4PpYWmak3eX5/IZC1d1ew0MWp0lo17aE6rIrNsLRSMk9mtCLQpDFxHHnpvKX9K1MWASytCQ5n6CJlEnbNHpopmxUmaZNLt7zlihTWAaj4cSPztgPpj9odJ2DDMK6hw8xu20YjDtLa8EYejO9z7k5PuJQKBgQCjITFfhy/Qax6BDKkTJJQBY38U2IYuBOsoVn5yduyoNwmJxkKll93YPNRWiepcuI81pzYqD6SHmXVm4RyAMPmXM85g7uyw189TrD7tLWo2khNX5g2tax3eLyonQ/kDm3gjoWZc1YCnjwx3s12kgiqoPUThAe7lGzeRBjAfNA+L4QKBgBNK4A+WzhjD+MS9ZGnuI1BiKvZ5wSp+Xd0aCMgzxFuXErw0DWmZWdlohPvNBamyRRtOcGp9fUpSHqvR1tf5Uk8CMIJ1HyhsARTSn9RS3jxhH2do7ErpGQBvG7FshlTSc9xmVRLEPvua8nRuQXKL12Rx/qIWrs0ieA8VKmW/C7U1AoGARvzMefjCWk5eqs3sUJIn5LBQo+i0hSDM9DupAyFZ7jg0w6ljaZnfp2j/uCAoIPRa92Bhwpx1LycYSG2IiY03x12fHQe/i9gYrhOZnf5CEmmAjTctmlF5dVeWSTfH7rvo2knHDtgc7g6GnencY8bfFKNuunya5N1R/jYps+GkvMQ=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAngeeZoLg5QBiwe1PikEAVvVlr0DuAUw1zMUwF03DCSN035vli1DyUYPtw0JGUZ2q4Zfi80wvgen4QzXbN0LvyxYpKMa/kr7uYbPOO4PEIA76LXzmO2Cau/c9JDhuAzSIlHYovacDaPQh+M9TInqz2cPIdpzMumJp382n5ziIEj57igG3ZYUWfM0Y0g0L8cfGAE1DMycuNPXgrBgwMzgM63DMk/H6flSxoLaQwNmp6/d0+xMcc1LZ14VF+gu45ayFu0VnpNtlSmGj+WWAu9TXfJ9wo+cb7CPnk2Wd3ECOCmEigYiUk/ZBsKuUsU5WIbtUMRR0gSiZtlDRp0kYjQJNpQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//    public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
//    public static String return_url = "http://localhost:8080/order/paySuccess";
    public static String return_url = "http://localhost:80/views/user_view/user_order.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
//    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

